<!-- File: /app/views/posts/index.ctp  (edit links added) -->
	
<h1>Blog posts</h1>
<p><?php

//echo $current_user;


echo $this->Html->link("Add Post", array('action' => 'add')); ?></p>
<table>
	<tr>
		<th>Id</th>
		<th>Title</th>
                <th>Tags</th>
                <th>Action</th>
		<th>Created</th>
	</tr>

<!-- Here's where we loop through our $posts array, printing out post info -->

<?php 



foreach ($posts as $post):
    
    ?>

	<tr>
		<td><?php echo $post['Post']['id']; ?></td>
		<td>
			<?php echo $this->Html->link($post['Post']['title'], array('action' => 'view', $post['Post']['id']));?>
                </td>
                <td class="tagthem"><?php 
                
                foreach ($post['Tag'] as $tag)
                    {
                             if (strpos($tag['tag'],"board:")!==false)
                                 echo "<a class='boardLink' href='/urp/posts/search/?search=".$tag['tag']."'>".$tag['tag']."</a>, ";
                             else if (strpos($tag['tag'],"test:")!==false)
                                 echo "<a class='boardLink1' href='/urp/posts/search/?search=".$tag['tag']."'>".$tag['tag']."</a>, ";
                             else
                                 echo "<a href='/urp/posts/search/?search=".$tag['tag']."' >".$tag['tag']."</a>, ";
                    }
               
                
                ?></td>
                
                <td>
			<?php echo $this->Html->link(
				'Delete', 
				array('action' => 'delete', $post['Post']['id']), 
				null, 
				'Are you sure?'
			)?>
			<?php echo $this->Html->link('Edit', array('action' => 'edit', $post['Post']['id']));?>
		</td>
                <td>
                    <?php echo $post['Post']['created']; ?>
                </td>
	</tr>
<?php endforeach; ?>

</table>
<?php print_r($cows) ?>